/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-04-06
 * Time: 15:49
 */
class Animal {
    public String name = "花花";//名字
    public int age;//年龄
    public String furColor;//毛颜色

    static {
        System.out.println("我是父类的静态代码块！！！");
    }

    {
        System.out.println("我是父类的实例化代码块！！！");
    }

    public void eat() {
        System.out.println(this.name + "吃饭！！！");
    }

    public void sleep() {
        System.out.println(this.name + "睡觉！！！");
    }

    public void method() {
        System.out.println("我是父类的方法！！！");
    }

    public Animal(String name, int age, String furColor) {
        this.name = name;
        this.age = age;
        this.furColor = furColor;
        System.out.println("我是父类的构造方法！！！");
    }
}

//实现一个猫类
class Cat extends Animal {
    public String name = "咪咪";
    static {
        System.out.println("我是子类的静态代码块！！！");
    }

    {
        System.out.println("我是子类的实例化代码块！！！");
    }
    public Cat(String name, int age, String furColor) {
        super(name, age, furColor);
        System.out.println("我是子类的构造方法！！！");
    }

    public void mew() {
        System.out.println(this.name + "喵喵喵");
    }

    public void method() {
        System.out.println("我是子类的方法");
    }

    public void methodA() {
        super.method();
    }
}

public class TestDemo {
    public static void main(String[] args) {
        Cat cat = new Cat("咪咪",18,"橘黄色");
        System.out.println("------------我是分割线----------------");
        Cat cat1 = new Cat("咪咪",18,"橘黄色");
    }
}

